// 在http.js中引入axios
import axios from 'axios'; // 引入axios


//配置axios 实例
const axiosInstance = axios.create({
  baseURL: "https://api.it120.cc/small4",
  timeout: 10000
})

export function request(method,url,params) {
  switch (method) {
    case "GET":
      return GET(url, params);
    case "POST":
      return POST(url, params);
  }
}


//提供不同的请求方式
function GET(url, params) {
  return axiosInstance.get(url, params)
}


function POST(url, params) {
  return axiosInstance.post(url, params)
}